<template>
  <!-- 资产库管理 -->
  <div class="app-container hk-flex-column">
    <el-row :gutter="20" class="app-row">
      <!-- 左侧 -->
      <div class="col-left">
        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
          <el-tab-pane label="在用" name="0" style="overflow: auto">
            <div class="card-tree">
              <el-tree
                ref="leftTree"
                style="height: 100%; width: 100%"
                :data="deptOptions"
                :props="defaultProps"
                :default-expanded-keys="defaultExpandedKeys"
                :current-node-key="queryParams.deptId"
                :expand-on-click-node="false"
                node-key="id"
                :highlight-current="highlight"
                :filter-node-method="filterNode"
                :render-content="renderContent"
                @node-click="handleNodeClick"
                />
            </div>
          </el-tab-pane>
          <el-tab-pane label="空闲" name="1">
            <el-tree
              ref="rightTree"
              style="height: 100%; width: 100%"
              :data="dictList.regionList"
              :props="defaultProps"
              :expand-on-click-node="false"
              node-key="id"
              :current-node-key="queryParams.storageDistrict"
              :highlight-current="highlight"
              :filter-node-method="filterNode"
              @node-click="handLocation" />
          </el-tab-pane>
        </el-tabs>
      </div>
      <!-- 右侧主题 -->
      <div class="col-right">
        <div class="col-top">
          <el-row v-if="countArr" style="padding-bottom: 1.25rem; display: flex">
            <el-button size="mini" @click="allSearch()">全部（台）{{ countArr.sum || 0 }}</el-button>
            <div
              v-if="queryParams.usageStatus !== '2'"
              style="
                background: #d8d8d8;
                width: 0.0625rem;
                height: 2rem;
                margin-left: 0.9375rem;
                margin-right: 0.9375rem;
              " />
            <el-radio-group
              v-if="queryParams.usageStatus !== '2'"
              v-model="queryParams.usageStatus"
              size="small"
              @input="changeSearch($event, 'usageStatus')">
              <el-radio-button label="1">领用中（台）{{ countArr.usageStatus[0].value }}</el-radio-button>
              <el-radio-button label="3">借用中（台）{{ countArr.usageStatus[1].value }}</el-radio-button>
            </el-radio-group>
            <div
              style="
                background: #d8d8d8;
                width: 0.0625rem;
                height: 2rem;
                margin-left: 0.9375rem;
                margin-right: 0.9375rem;
              " />
            <el-radio-group v-model="queryParams.status" size="small" @input="changeSearch($event, 'status')">
              <el-radio-button label="1">正常（台）{{ countArr.deviceStatus[0].value }}</el-radio-button>
            </el-radio-group>

            <div
              style="
                background: #d8d8d8;
                width: 0.0625rem;
                height: 2rem;
                margin-left: 0.9375rem;
                margin-right: 0.9375rem;
              " />
            <el-radio-group
              v-model="queryParams.securityLevel"
              size="small"
              @input="changeSearch($event, 'securityLevel')">
              <el-radio-button label="3">秘密（台）{{ countArr.securityLevel[1].value }}</el-radio-button>
              <el-radio-button label="5">机密（台）{{ countArr.securityLevel[0].value }}</el-radio-button>
            </el-radio-group>
          </el-row>
        </div>
        <!-- 搜索框 -->
        <div class="new-asset">
          <search-form
            :data="queryParams"
            :field-list="fieldList"
            :list-type-info="dictList"
            :is-asset="true"
            style="padding-bottom: 0rem"
            @handleSearch="handleQuery"
            @handleReset="resetQuery"
            @handleInfo="handleInfo">
            <template #downBtn>
              <el-row style="display: flex">
                <el-button size="mini" icon="el-icon-plus" @click="handleOpen()">入库</el-button>

                <el-button size="mini" icon="el-icon-upload2" @click="handleImport()">导入</el-button>
                <el-button size="mini" @click="handleDown()">下载模板</el-button>
              </el-row>
            </template>
            <template #filter-assetTypeId>
              <div class="ca-select clearfix">
                <el-select
                  ref="selectIt"
                  v-model="assetValue"
                  :options="citiesList"
                  style="width: 220px"
                  class="fake"
                  multiple
                  @change="clearSelect"
                  @focus="selectFocus">
                  <el-option v-for="item in citiesList" :key="item.id" :label="item.dictValue" :value="item.id" />
                </el-select>
                <el-cascader
                  ref="cascader"
                  v-model="queryParams.assetTypeId"
                  filterable
                  :options="dictList.typeList"
                  :props="assetProps"
                  :show-all-levels="false"
                  clearable
                  style="width: 220px"
                  class="test"
                  :collapse-tags="false"
                  @expand-change="expandChange"
                  @change="handleChange($event, 'cascader')" />
              </div>
            </template>
          </search-form>
        </div>
        <!-- 按钮组 -->

        <!-- 表格 -->
        <hk-table
          :table-data="tableData"
          :table-columns="tableList"
          :selection="true"
          :show-index="true"
          :total="total"
          :loading="loading"
          :table-height="80"
          operate
          :common-fixed="true"
          :show-overflow-tooltip="false"
          :query-params="queryParams"
          :operate-width="220"
          :pager-count="5"
          @handleSelectionChange="handleSelectionChange"
          @changePage="getDataList">
          <!-- 更改表格中数据的样式 -->
          <!-- 设备名称 -->
          <template #assetName="scope">
            <div style="display: flex">
              <el-tooltip v-if="scope.row.assetName.length > 5 && scope.row.assetName.length < 21" placement="top">
                <span slot="content">{{ scope.row.assetName }}</span>
                <span
                  style="
                    display: inline-block;
                    max-width: 50%;
                    overflow: hidden;
                    white-space: nowrap;
                    text-overflow: ellipsis;
                  "
                  >{{ scope.row.assetName }}</span
                >
              </el-tooltip>

              <span
                v-else
                style="
                  display: inline-block;
                  max-width: 50%;
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;
                "
                >{{ scope.row.assetName }}</span
              >
              <span v-if="scope.row.showReturn == true" class="hk-tag">还</span>
              <span v-if="scope.row.showSecurity == true" class="hk-tag serious">普秘</span>
              <span v-if="scope.row.showRepair == true" class="hk-tag fairly">过保</span>
            </div>
          </template>
          <!-- 状态 -->
          <template #status="scope">
            <div v-if="scope.row.status == '正常'" style="display: inline-block">
              <img
                src="@/assets/images/status1.png"
                alt="example"
                style="
                  vertical-align: middle;
                  width: 1rem;
                  height: 1rem;
                  margin-right: 0.3125rem;
                  margin-top: -0.25rem;
                " />
              <span style="font-size: 0.875rem; color: #4b6eef">{{ scope.row.status }}</span>
            </div>
            <div v-else-if="scope.row.status == '维护中'">
              <img
                src="@/assets/images/status2.png"
                alt="example"
                style="
                  vertical-align: middle;
                  width: 0.9375rem;
                  height: 1rem;
                  margin-right: 0.3125rem;
                  margin-top: -0.25rem;
                " />
              <span style="font-size: 0.875rem; color: #3abf81">{{ scope.row.status }}</span>
            </div>
            <div v-else>
              <img
                src="@/assets/images/status3.png"
                alt="example"
                style="
                  vertical-align: middle;
                  width: 0.9375rem;
                  height: 1rem;
                  margin-right: 0.3125rem;
                  margin-top: -0.25rem;
                " />
              <!-- <img :src="`${imageUrl}`" alt="图片"> -->
              <span style="font-size: 0.875rem" class="bf-status">{{ scope.row.status }}</span>
            </div>
          </template>
          <!-- 使用状态 -->
          <template #usageStatus="scope">
            <div v-if="scope.row.usageStatus == '领用中'" style="display: inline-block">
              <span style="font-size: 0.875rem; color: #4b6eef">{{ scope.row.usageStatus }}</span>
            </div>
            <div v-else-if="scope.row.usageStatus == '借用中'">
              <span style="font-size: 0.875rem; color: #3abf81">{{ scope.row.usageStatus }}</span>
            </div>
            <div v-else>
              <!-- <img :src="`${imageUrl}`" alt="图片"> -->
              <span style="font-size: 0.875rem; color: #ff3535">{{ scope.row.usageStatus }}</span>
            </div>
          </template>
          <!-- 操作权限 -->
          <template #operate="scope">
            <!-- {{ scope.row.assetDepartmentId }} -->
            <!-- <el-button size="mini" type="text" @click="handleEdit(scope.row)">修改 </el-button> -->
            <el-button v-hasPermi="['asset:list:edit']" size="mini" type="text" @click="handleEdit(scope.row)"
              >修改
            </el-button>
            <el-button v-hasPermi="['asset:list:del']" size="mini" type="text" @click="handleDelete(scope.row)"
              >删除</el-button
            >
            <el-button size="mini" type="text" @click="handleDetail(scope.row)">详情 </el-button>
            <!-- <el-button size="mini" type="text" @click="handleEdit(scope.row)">标签打印 </el-button> -->
            <!-- <el-button
              v-if="scope.row.status === '审核中'"
              size="mini"
              type="text"
              @click="handleExamine(scope.row)"
            >审核
            </el-button> -->
          </template>
        </hk-table>
        <div class="table-out">
          <div class="out-son">
            <el-row style="padding-top: 1.25rem; display: flex">
              <el-dropdown trigger="click" placement="top" @command="openTransfer">
                <el-button size="mini" icon="el-icon-refresh-right" :disabled="multiple">调拨</el-button>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item command="1">调拨责任人</el-dropdown-item>
                  <el-dropdown-item command="2">调拨存放区域</el-dropdown-item>
                  <el-dropdown-item command="3">调拨存放位置</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
              <div
                style="
                  background: #d8d8d8;
                  width: 0.0625rem;
                  height: 2rem;
                  margin-left: 0.9375rem;
                  margin-right: 0.9375rem;
                " />
              <el-button size="mini" icon="el-icon-folder-add" :disabled="useMultiple" @click="handleUse()"
                >领用</el-button
              >
              <el-button size="mini" icon="el-icon-top-right" :disabled="useMultiple" @click="handleBorrow()"
                >借用</el-button
              >
              <el-button size="mini" icon="el-icon-top-left" :disabled="returnMultiple" @click="handleReturn()"
                >归还</el-button
              >
              <div
                style="
                  background: #d8d8d8;
                  width: 0.0625rem;
                  height: 2rem;
                  margin-left: 0.9375rem;
                  margin-right: 0.9375rem;
                " />
              <el-button size="mini" icon="el-icon-s-tools" :disabled="repairMultiple" @click="handleRepair()"
                >维修</el-button
              >
              <el-button size="mini" icon="el-icon-delete" :disabled="scrapMultiple" @click="handleDiscard()"
                >报废</el-button
              >
              <el-button size="mini" icon="el-icon-brush" :disabled="badMultiple" @click="handleToDiscard()"
                >待报废</el-button
              >
              <div
                style="
                  background: #d8d8d8;
                  width: 0.0625rem;
                  height: 2rem;
                  margin-left: 0.9375rem;
                  margin-right: 0.9375rem;
                " />
              <el-button size="mini" icon="el-icon-download" @click="handleExport()">导出查询结果</el-button>
            </el-row>
          </div>
        </div>
      </div>
    </el-row>
    <hk-upload
      ref="import_dia"
      :url="url"
      title="导入"
      :multiple="multipleUp"
      :accept="accept"
      success-desc="上传成功"
      @submit="getDataList()" />
    <!-- 入库弹窗  -->
    <el-dialog class="roku" title="新增资产分类" width="500px" :visible.sync="dialogVisible" destroy-on-close>
      <el-divider />
      <el-row :gutter="2" class="dialog-row">
        <el-col v-for="item in dictList.assetList" :key="item.id" :span="6">
          <div class="asset-type" :class="firstItem.id == item.id ? 'chose' : ''" @click="handleAdd(item)">
            {{ item.dictValue }}
          </div>
        </el-col>
      </el-row>
      <el-divider />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="nextStep">下一步</el-button>
      </span>
    </el-dialog>
    <!-- 借用  -->
    <el-dialog class="roku" width="80%" :title="borrowTitle" :visible.sync="borrowVisible" :destroy-on-close="true">
      <manage v-if="borrowVisible" :prop-data="propData" @close="closeBorrow" @send="sendData" />
    </el-dialog>
    <!-- 调拨  -->
    <el-dialog class="roku" width="80%" :title="tranTitle" :visible.sync="tranVisible" :destroy-on-close="true">
      <el-divider />
      <exhibit v-if="tranVisible" ref="exhibit" :prop-data="propData" @close="closeBorrow" @send="sendData" />
      <el-divider />
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="saveData">保存</el-button>
        <el-button @click="tranVisible = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import SearchForm from '@/components/HkSearchform/index.vue'
import HkTable from '@/components/Hk-Table/index.vue'
import manage from './components/manage.vue'
import exhibit from './components/exhibit.vue'
import {
  pageList,
  getDict,
  deleteItem,
  dictItemsList,
  downFile,
  batchUpdate,
  batchDetail,
  userList,
  assetDict,
  assetsCount,
} from '@/api/specialProject/asset'
import { treeSelect } from '@/api/specialProject/personnel'

export default {
  components: {
    SearchForm,
    HkTable,
    manage,
    exhibit,
  },
  beforeRouteLeave(to, from, next) {
    console.log(to, '路由')
    if (to.path === '/specialProject/assets/assetLibraryDetail') {
      const condition = JSON.stringify(this.queryParams)
      const assetValue = JSON.stringify(this.assetValue)
      const citiesList = JSON.stringify(this.citiesList)
      sessionStorage.setItem('condition', condition)
      sessionStorage.setItem('assetValue', assetValue)
      sessionStorage.setItem('citiesList', citiesList)
    } else {
      sessionStorage.removeItem('condition')
      sessionStorage.removeItem('assetValue')
      sessionStorage.removeItem('citiesList')
    }
    next()
  },
  beforeRouteEnter(to, from, next) {
    console.log(to, '路由')
    if (from.path !== '/specialProject/assets/assetLibraryDetail') {
      sessionStorage.removeItem('condition')
      sessionStorage.removeItem('assetValue')
      sessionStorage.removeItem('citiesList')
    }
    next()
  },
  data() {
    return {
      highlight: true,
      activeName: '1',
      assetValue: [],
      nodeList: [],
      resArr: [],
      multipleUp: false,
      tranTitle: '调拨',
      tranVisible: false,
      borrowTitle: '借用',
      borrowVisible: false,
      dialogVisible: false,
      // 导入
      choseName: '',
      url: window.baseUrl.action + '/assetsInfo/upload',
      accept: '.xlsx',
      showTop: false,
      // showBottom: false,
      //  树结构
      deptOptions: [
        {
          name: '鸿科信息',
          // 控制图标
          showchild: true,
          children: [{ name: '研发部' }, { name: '测试部' }, { name: '运维部' }],
        },
      ],

      defaultProps: {
        children: 'children',
        label: 'name',
      },
      selectArr: [],
      propData: {},
      assetProps: {
        children: 'children',
        label: 'dictValue',
        value: 'id',
        emitPath: false,
        multiple: true,
      },
      // 搜索框
      fieldList: [
        {
          label: '关键字',
          type: 'input',
          field: 'keyword',
          width: '245px',
          maxlength: 20,
          placeholder: '请输入设备名称、编号、IP或责任人',
        },
        {
          label: '设备类型',
          type: 'slot',
          // type: 'cascader',
          field: 'assetTypeId',
          list: 'typeList',
          width: '220px',
          // collapseTag: true,
          // props: {
          //   children: 'children',
          //   label: 'dictValue',
          //   value: 'id',
          //   emitPath: false,
          //   multiple: true,
          // },
        },
        {
          label: '设备状态',
          type: 'select',
          field: 'status',
          maxlength: 20,
          list: 'statusList',
          width: '130px',
        },
        {
          label: '使用状态',
          type: 'select',
          field: 'usageStatus',
          maxlength: 20,
          list: 'usageList',
          width: '150px',
          hidden: true,
        },
        {
          label: '设备来源',
          type: 'select',
          field: 'assetSource',
          maxlength: 20,
          list: 'assetSourceList',
          width: '130px',
        },
        {
          label: '设备密级',
          type: 'select',
          field: 'securityLevel',
          maxlength: 20,
          list: 'levelList',
          width: '130px',
        },
      ],
      dictList: {
        assetList: [],
        typeList: [],
        statusList: [],
        usageList: [],
        assetSourceList: [],
        levelList: [],
        regionList: [],
      },

      defaultExpandedKeys: [],
      // 表格
      tableList: [
        { label: '设备名称', param: 'assetName', type: 'slot', width: '200', showTip: false },
        { label: '设备编号', param: 'assetCode' },
        { label: '设备IP', param: 'ip', width: '150' },
        // { label: '设备MAC', param: 'mac', width: '200' },
        // { label: '类别', param: 'assetCategory', width: '150' },
        { label: '设备类型', param: 'assetType', width: '200' },
        // { label: '联网类型', param: 'networkConnectionType', width: '150' },
        { label: '设备状态', param: 'status', type: 'slot' },
        { label: '责任人', param: 'ownerName', width: '150' },
        // { label: '责任部门', param: 'assetDepartmentName', width: '200' },
        { label: '使用状态', param: 'usageStatus', type: 'slot' },
        // { label: '密级', param: 'securityLevel', type: 'slot', width: '100' },
        // { label: '过保时间', param: 'expirationOfWarrantyDay' },
        // { label: '待归还时间', param: 'expectedReturnDay', width: '100' },
        // { label: '操作', param: 'operate', type: 'slot', width: 300 }
      ],
      tableData: [],
      queryParams: {
        current: 1,
        size: 10,
        usageStatus: '2',
      },
      loading: false,
      // 选中的id值们
      ids: [],
      // 非多个禁用
      multiple: true, //调拨
      useMultiple: true, //领用
      returnMultiple: true, //归还
      repairMultiple: true, //维修
      scrapMultiple: true, //报废
      badMultiple: true, //待报废
      // 弹框的标题
      title: '',
      // 分页总条数
      total: 0,
      code: this.$route.query.id,
      firstItem: {},
      timer: null,
      citiesList: [],
      countArr: {},
    }
  },
  created() {
    var citiesList = sessionStorage.getItem('citiesList')
    if (citiesList) {
      var ct = JSON.parse(citiesList)
      this.citiesList = ct
    }
    var assetValue = sessionStorage.getItem('assetValue')
    if (assetValue) {
      var data = JSON.parse(assetValue)
      this.assetValue = data
    }
    var cd = sessionStorage.getItem('condition')
    console.log(cd, 'ddddd')
    if (cd) {
      var condition = JSON.parse(cd)
      if (condition.usageStatus) {
        if (condition.usageStatus === '1,3') {
          this.activeName = '0'
        } else {
          this.activeName = '1'
        }
        this.getCount(condition.usageStatus)
      } else {
        this.activeName = '1'
        this.getCount(2)
      }

      this.queryParams = condition
    } else {
      this.getCount(2)
    }

    if (this.$route.params.key) {
      this.queryParams[this.$route.params.key] = this.$route.params.value
    }
  },
  mounted() {
    this.getDataList()
    this.getDictDatas()
    this.getDeptTree()
  },
  methods: {
    renderContent(h, { node, data, store }) {
      return (
        <div class="custom-tree-node">
          <el-tooltip class="item" effect="dark" placement="top">
            <div slot="content">{node.label}</div>
            <p>{node.label}</p>
          </el-tooltip>
        </div>
      )
    },
    getCount(usageStatus) {
      assetsCount({ usageStatus: usageStatus }).then((res) => {
        this.countArr = res
      })
    },
    changeSearch(e, item) {
      console.log(e, item, 'e')
      this.queryParams[item] = e
      this.$set(this.queryParams, `${item}`, e)
      this.getDataList()
    },
    allSearch() {
      this.resetQuery()
    },
    handleClick(e) {
      console.log(e.name, 'ee')
      this.activeName = e.name
      if (e.name === '0') {
        // 再用
        this.$refs.leftTree.setCurrentKey(null)
        this.queryParams.usageStatus = '1,3'
        this.queryParams.storageDistrict = null
        this.$set(this.queryParams, 'usageStatus', '1,3')
        this.getCount('1,3')
      } else {
        this.$refs.rightTree.setCurrentKey(null)
        // 空闲
        this.getCount('2')
        this.queryParams.deptId = null
        this.queryParams.usageStatus = '2'
        this.$set(this.queryParams, 'usageStatus', '2')
      }
      this.queryParams.current = 1
      this.getDataList()
    },
    // 再用树点击节点筛选
    handleNodeClick(data) {
      this.queryParams.deptId = data.id
      this.queryParams.storageDistrict = null
      this.queryParams.current = 1
      this.getDataList()
    },
    // 空闲树点击节点筛选
    handLocation(data) {
      this.queryParams.storageDistrict = data.id
      this.queryParams.deptId = null
      this.queryParams.current = 1
      this.getDataList()
    },

    async clearSelect(e) {
      const result = this.nodeList.filter((item) => e.includes(item.value))
      if (!result) {
        this.assetValue = []
        this.citiesList = []
        this.queryParams.assetTypeId = []
      } else {
        this.nodeList = result
        const idArr = []
        this.citiesList = []
        for (let i = 0; i < result.length; i++) {
          idArr.push(result[i].value)
          this.citiesList.push(result[i].data)
        }
        this.assetValue = idArr
        this.resArr = []
        await this.getNodeId(result)
        this.queryParams.assetTypeId = this.resArr
      }
    },
    // 抽取树节点以及所有子节点的id 构成数组
    getNodeId(array) {
      for (var item of array) {
        this.resArr.push(item.value)
        if (item.children.length > 0) {
          this.getNodeId(item.children)
        }
      }
    },
    selectFocus() {
      var that = this
      this.$refs.selectIt.blur()
      var timer = setInterval(() => {
        that.$refs.cascader.toggleDropDownVisible(true)
        clearInterval(timer)
      }, 200)
    },
    // 级联框
    handleChange(e, item) {
      if (!e) {
        this.assetValue = []
        this.citiesList = []
      } else {
        let nodeList = this.$refs[item].getCheckedNodes()
        // 如果三级全选就显示二级的，没有全选就显示三级的
        nodeList = nodeList.filter((option) => !(option.parent && option.parent.checked))
        console.log(nodeList, '1111')
        this.nodeList = nodeList
        const idArr = []
        this.citiesList = []
        for (let i = 0; i < nodeList.length; i++) {
          idArr.push(nodeList[i].value)
          this.citiesList.push(nodeList[i].data)
        }
        this.assetValue = idArr
      }
    },
    // 解决级联选死机问题
    expandChange() {
      this.$nextTick(() => {
        // 添加这段代码
        const $el = document.querySelectorAll('.el-cascader-panel .el-cascader-node[aria-owns]')
        Array.from($el).map((item) => item.removeAttribute('aria-owns'))
      })
    },
    // 调拨保存
    saveData() {
      this.$refs.exhibit.submitForm()
    },
    sendData(e) {
      batchUpdate(e).then((res) => {
        this.handleQuery()
      })
    },
    // 关闭弹窗
    closeBorrow() {
      this.borrowVisible = false
      this.tranVisible = false
    },
    handleInfo(e) {
      console.log(e, 'eee')

      this.queryParams.assetType = e.dictKey
    },
    //  查询列表
    getDataList() {
      this.loading = true

      // var fd = new FormData()
      // Object.keys(this.queryParams).forEach((key) => {
      //   console.log(key)
      //   fd.append(`${key}`, this.queryParams[key])
      // })
      if (this.queryParams.assetTypeId) {
        this.queryParams.assetTypeId = this.queryParams.assetTypeId.toString()
      }
      pageList(this.queryParams).then((res) => {
        // 返回值为null，展示---
        res.list.forEach((element) => {
          for (const key in element) {
            element[key] = element[key] || '—'
          }
        })
        this.tableData = res.list
        this.total = res.total
        this.loading = false
        const condition = JSON.stringify(this.queryParams)
        const assetValue = JSON.stringify(this.assetValue)
        const citiesList = JSON.stringify(this.citiesList)
        sessionStorage.setItem('condition', condition)
        sessionStorage.setItem('assetValue', assetValue)
        sessionStorage.setItem('citiesList', citiesList)
      })
    },
    // 字典获取
    getDictDatas() {
      // 入口弹窗list
      getDict({ code: 'assetCategory' }).then((res) => {
        this.dictList.assetList = res.map((o) => {
          o.label = o.dictValue
          o.value = o.dictKey
          return o
        })
      })
      // 区域
      assetDict('deposit_region').then((res) => {
        this.dictList.regionList = res.map((o) => {
          o.label = o.name
          o.value = o.id
          return o
        })
      })
      // 使用状态
      getDict({ code: 'usageStatus' }).then((res) => {
        this.dictList.usageList = res.map((o) => {
          o.label = o.dictValue
          o.value = o.dictKey
          return o
        })
      })
      // 设备来源
      getDict({ code: 'assetSource' }).then((res) => {
        this.dictList.assetSourceList = res.map((o) => {
          o.label = o.dictValue
          o.value = o.dictKey
          return o
        })
      })
      // 设备密级
      getDict({ code: 'securityLevel' }).then((res) => {
        this.dictList.levelList = res.map((o) => {
          o.label = o.dictValue
          o.value = o.dictKey
          return o
        })
      })
      dictItemsList({ parentId: 0 }).then((res) => {
        this.dictList.typeList = res
      })
      getDict({ code: 'deviceStatus' }).then((res) => {
        this.dictList.statusList = res.filter((o) => {
          if (o.dictKey !== '3') {
            o.label = o.dictValue
            o.value = o.dictKey
            return o
          }
        })
      })
    },
    // 树查询
    getDeptTree(val) {
      treeSelect().then((res) => {
        this.deptOptions = res
        if (this.deptOptions.length > 0) {
          this.defaultExpandedKeys.push(this.deptOptions[0].id)
        }
      })
    },
    // 树搜索
    filterNode(value, data) {
      if (!value) return true
      return data.name.indexOf(value) !== -1
    },

    // 多选框选中数据   控制批量
    handleSelectionChange(selection) {
      this.selectArr = selection

      if (selection.length > 0) {
        this.ids = selection.map((item) => item.id)
        var isRj = selection.findIndex((item) => {
          return item.assetCategory === '软件系统' || item.assetCategory === '无形资产'
        })
        if (isRj !== -1) {
          this.multiple = true
          this.useMultiple = true
          this.returnMultiple = true
          this.repairMultiple = true
          this.scrapMultiple = true
          this.badMultiple = true
          return false
        }
        // 能否调拨
        var isK = selection.findIndex((item) => {
          return item.usageStatus !== '空闲'
        })
        if (isK !== -1) {
          this.multiple = true
        } else {
          this.multiple = false
        }

        // 能否借用领用
        var idx = selection.findIndex((item) => {
          return item.usageStatus !== '空闲'
        })
        if (idx === -1) {
          this.useMultiple = false
        } else {
          this.useMultiple = true
        }
        // 能否归还
        var isRT = selection.findIndex((item) => {
          return item.usageStatus !== '在用(领用中)' && item.usageStatus !== '在用(借用中)'
        })
        if (isRT === -1) {
          this.returnMultiple = false
        } else {
          this.returnMultiple = true
        }
        // 是否报废

        var isBD = selection.filter((item) => {
          return item.status === '待报废'
        })
        console.log(isBD, 'ssss')

        if (isBD.length !== selection.length) {
          if (isBD.length > 0) {
            // 有待报废 正常 维修
            this.scrapMultiple = true
            this.repairMultiple = true
            this.badMultiple = true
          } else {
            // 只有正常 维修
            var isWX = selection.findIndex((item) => {
              return item.status === '维护中'
            })
            if (isWX !== -1) {
              // 有维修
              this.scrapMultiple = true
              this.repairMultiple = true
              this.badMultiple = false
            } else {
              this.scrapMultiple = true
              this.repairMultiple = false
              this.badMultiple = false
            }
          }
        } else {
          // 全是待报废
          this.scrapMultiple = false
          this.repairMultiple = true
          this.badMultiple = true
        }
      } else {
        this.ids = []
        this.multiple = true
        this.useMultiple = true
        this.returnMultiple = true
        this.repairMultiple = true
      }
    },
    // 删除数据
    handleDelete(row) {
      this.$modal
        .confirm('您确定要删除当前数据吗')
        .then(function () {
          return deleteItem(row.id)
        })
        .then(() => {
          this.$modal.msgSuccess('删除成功')
          this.getDataList()
        })
        .catch((error) => {
          console.log(error)
        })
    },
    // 搜索按钮
    handleQuery(val) {
      this.queryParams.current = 1
      this.getDataList()
    },
    // 重置按钮
    resetQuery() {
      this.$refs.leftTree.setCurrentKey(null)
      this.$refs.rightTree.setCurrentKey(null)
      this.assetValue = []
      this.citiesList = []
      this.queryParams = {}
      this.queryParams.current = 1
      this.queryParams.size = 10
      this.choseName = ''
      this.choseType = ''
      if (this.activeName === '0') {
        this.queryParams.usageStatus = '1,3'
        this.$set(this.queryParams, 'usageStatus', '1,3')
      } else {
        this.queryParams.usageStatus = '2'
        this.$set(this.queryParams, 'usageStatus', '2')
      }
      this.getDataList()
    },
    // 打开入库弹窗
    handleOpen() {
      this.dialogVisible = true
    },
    nextStep() {
      this.dialogVisible = false
      this.$router.push({
        path: '/specialProject/assets/assetLibraryDetail',
        query: {
          title: '入库',
          dictValue: this.firstItem.dictValue,
          dictKey: this.firstItem.dictKey,
          dictId: this.firstItem.id,
        },
      })
    },
    //  批量查询
    async getDetails() {
      var id = this.ids.toString()
      const data = await batchDetail(id)
      return data
    },
    // 入库
    handleAdd(item) {
      console.log(item, 'sssss')
      this.firstItem = item
    },
    openTransfer(e) {
      console.log(e)
      this.handleTransfer(e)
    },
    // 调拨
    async handleTransfer(e) {
      var data = await this.getDetails()
      data.forEach((item) => {
        item.assetChangeLogType = 0
      })

      this.tranTitle = '调拨'
      this.tranVisible = true
      var newData = []
      if (e === '1') {
        // 调拨责任人
        for (var item of data) {
          var obj = {
            assetCode: item.assetCode,
            assetDepartmentName: item.assetDepartmentName || '一',
            ownerName: item.ownerName || '一',
          }
          newData.push(obj)
          item.assetDepartmentName = undefined
          item.ownerName = undefined
          item.storageLocation = undefined
          item.assetDepartmentId = undefined
          item.ownerId = undefined
        }
        this.propData = {
          selectData: data,
          operateType: 0,
          newData: newData,
          disList: [
            { label: '设备编号', param: 'assetCode' },
            { label: '责任部门', param: 'assetDepartmentName' },
            { label: '责任人', param: 'ownerName' },
          ],
          type: '1',
          labels: [
            { label: '责任部门', field: 'assetDepartmentId', span: 24, type: 'slot', list: 'deptList' },
            { label: '责任人', field: 'ownerId', span: 24, type: 'slot', list: 'userList' },
          ],
          rules: {
            assetDepartmentId: [{ required: true, message: '请选择', trigger: 'blur' }],
            ownerId: [{ required: true, message: '请选择', trigger: 'blur' }],
          },
        }
      }
      if (e === '2') {
        // 调拨区域

        for (var item1 of data) {
          var obj1 = {
            assetCode: item1.assetCode,
            storageDistrictName: item1.storageDistrictName || '-',
          }
          newData.push(obj1)
          item1.assetDepartmentName = undefined
          item1.ownerName = undefined
          item1.storageLocation = undefined
          item1.assetDepartmentId = undefined
          item1.ownerId = undefined
        }
        this.propData = {
          selectData: data,
          operateType: 0,
          newData: newData,
          disList: [
            { label: '设备编号', param: 'assetCode' },
            { label: '存放区域', param: 'storageDistrictName' },
          ],
          labels: [{ label: '存放区域', field: 'storageDistrict', span: 24, type: 'select', list: 'regionList' }],
          rules: {
            storageDistrict: [{ required: true, message: '请选择', trigger: 'blur' }],
          },
        }
      }
      if (e === '3') {
        // 调拨位置

        for (var item2 of data) {
          var obj2 = {
            assetCode: item2.assetCode,
            storageLocation: item2.storageLocation || '一',
          }
          newData.push(obj2)
          item2.assetDepartmentName = undefined
          item2.ownerName = undefined
          item2.storageLocation = undefined
          item2.assetDepartmentId = undefined
          item2.ownerId = undefined
        }
        this.propData = {
          selectData: data,
          newData: newData,
          operateType: 0,
          disList: [
            { label: '设备编号', param: 'assetCode' },
            { label: '存放位置', param: 'storageLocation' },
          ],
          labels: [{ label: '存放位置', field: 'storageLocation', span: 24, type: 'input', maxlength: '50' }],
          rules: {
            storageLocation: [{ required: true, message: '请选择', trigger: 'blur' }],
          },
        }
      }

      // this.$router.push({ path: '/specialProject/assetLibraryDetail', query: { id: this.ids[0], title: '调拨' } })
    },
    // 领用
    async handleUse() {
      var data = await this.getDetails()
      data.forEach((item) => {
        item.usageStatus = '1'
        item.assetChangeLogType = 1
      })
      this.propData = {}
      this.borrowTitle = '领用'
      this.borrowVisible = true
      this.propData = {
        selectData: data,
        formRules: {
          storageDistrict: [{ required: true, message: '不能为空', trigger: 'blur' }],
          newStorageLocation: [{ required: true, message: '不能为空', trigger: 'blur' }],
          assetsChangesAnnexDTPList: [{ required: true, message: '不能为空', trigger: 'change' }],
          assetDepartmentId: [{ required: true, message: '不能为空', trigger: 'blur' }],
          ownerId: [{ required: true, message: '不能为空', trigger: 'blur' }],
        },
        tableDataList: [
          { label: '设备编号', param: 'assetCode' },
          { label: '设备IP', param: 'ip', type: 'input', maxlength: '50' },
          { label: '设备密级', param: 'securityLevel', type: 'select', list: 'securityList', disabled: true },
          { label: '刻录权限', param: 'burnPermission', type: 'select', list: 'burnList' },
          { label: '使用类型', param: 'usageType', type: 'select', list: 'usageTypeList' },
          { label: '接入交换机', param: 'exchange', type: 'input', maxlength: '50' },
          { label: '存放区域', param: 'storageDistrict', type: 'select', list: 'regionList', disabled: true },
          { label: '存放位置', param: 'storageLocation', type: 'input', maxlength: '50' },
          // { label: '预计归还日期', param: 'expectedReturnTime', type: 'datePicker', format: 'yyyy-MM-dd' },
        ],
        basicList: [
          {
            label: '存放区域',
            field: 'storageDistrict',
            span: 12,
            list: 'regionList',
            type: 'select',
            maxlength: '50',
          },
          {
            label: '存放位置',
            field: 'newStorageLocation',
            span: 12,
            list: 'deptList',
            type: 'input',
            maxlength: '50',
          },
          {
            label: '责任部门',
            field: 'assetDepartmentId',
            span: 12,
            list: 'deptList',
            type: 'slot',
          },
          {
            label: '责任人',
            field: 'ownerId',
            type: 'select',
            span: 12,
            list: 'userList',
          },
          {
            label: '附件',
            field: 'assetsChangesAnnexDTPList',
            type: 'slot',
            span: 24,
          },
          {
            label: '',
            field: 'list',
            type: 'slot',
            span: 24,
            labelWidth: '0px',
          },
        ],
      }
      // this.$router.push({ path: '/specialProject/assets/assetLibraryDetail', query: { id: this.ids[0], title: '领用' } })
    },
    // 借用
    async handleBorrow() {
      var data = await this.getDetails()
      data.forEach((item) => {
        item.usageStatus = '3'
        item.assetChangeLogType = 2
      })
      this.propData = {}
      this.borrowTitle = '借用'
      this.borrowVisible = true
      this.propData = {
        selectData: data,
        formRules: {
          storageDistrict: [{ required: true, message: '不能为空', trigger: 'blur' }],
          newStorageLocation: [{ required: true, message: '不能为空', trigger: 'blur' }],
          assetDepartmentId: [{ required: true, message: '不能为空', trigger: 'blur' }],
          ownerId: [{ required: true, message: '不能为空', trigger: 'blur' }],
          assetsChangesAnnexDTPList: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
        },
        tableDataList: [
          { label: '设备编号', param: 'assetCode' },
          { label: '设备IP', param: 'ip', type: 'input', maxlength: '50' },
          { label: '设备密级', param: 'securityLevel', type: 'select', list: 'securityList', disabled: true },
          { label: '刻录权限', param: 'burnPermission', type: 'select', list: 'burnList' },
          { label: '使用类型', param: 'usageType', type: 'select', list: 'usageTypeList' },
          { label: '接入交换机', param: 'exchange', type: 'input', maxlength: '50' },
          { label: '存放区域', param: 'storageDistrict', type: 'select', list: 'regionList', disabled: true },
          { label: '存放位置', param: 'storageLocation', type: 'input', maxlength: '50' },
          { label: '预计归还日期', param: 'expectedReturnTime', type: 'datePicker', format: 'yyyy-MM-dd' },
        ],
        basicList: [
          {
            label: '存放区域',
            field: 'storageDistrict',
            span: 12,
            list: 'regionList',
            type: 'select',
            maxlength: '50',
          },
          {
            label: '存放位置',
            field: 'newStorageLocation',
            span: 12,
            list: 'deptList',
            type: 'input',
            maxlength: '50',
          },
          {
            label: '责任部门',
            field: 'assetDepartmentId',
            span: 12,
            list: 'deptList',
            type: 'slot',
          },
          {
            label: '责任人',
            field: 'ownerId',
            type: 'select',
            span: 12,
            list: 'userList',
          },
          {
            label: '附件',
            field: 'assetsChangesAnnexDTPList',
            type: 'slot',
            span: 24,
          },
          {
            label: '',
            field: 'list',
            type: 'slot',
            span: 24,
            labelWidth: '0px',
          },
        ],
      }

      // this.$router.push({ path: '/specialProject/assets/assetLibraryDetail', query: { id: this.ids[0], title: '借用' } })
    },
    // 归还
    async handleReturn() {
      var data = await this.getDetails()
      data.forEach((item) => {
        item.usageStatus = '2'
        item.assetChangeLogType = 3
      })
      this.propData = {}
      this.borrowTitle = '归还'
      this.borrowVisible = true
      this.propData = {
        clear: true,
        empty: true,
        selectData: data,
        formRules: {
          storageDistrict: [{ required: true, message: '不能为空', trigger: 'blur' }],
          newStorageLocation: [{ required: true, message: '不能为空', trigger: 'blur' }],
          assetsChangesAnnexDTPList: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
        },
        tableDataList: [
          { label: '设备编号', param: 'assetCode' },
          { label: '设备IP', param: 'ip', type: 'input', maxlength: '50', disabled: true },
          { label: '设备密级', param: 'securityLevel', type: 'select', list: 'securityList', disabled: true },
          { label: '责任部门', param: 'assetDepartmentName', type: 'select', list: 'deptList', disabled: true },
          { label: '责任人', param: 'ownerName', type: 'select', list: 'userList', disabled: true },

          { label: '责任部门id', param: 'assetDepartmentId', type: 'select', list: 'deptList', show: true },
          { label: '责任人id', param: 'ownerId', type: 'select', list: 'userList', show: true },

          { label: '刻录权限', param: 'burnPermission', type: 'select', list: 'burnList', disabled: true },
          { label: '接入交换机', param: 'exchange', type: 'input', maxlength: '50', disabled: true },
          { label: '使用类型', param: 'usageType', type: 'select', list: 'usageTypeList', disabled: true },
          { label: '存放位置', param: 'storageLocation', type: 'input', maxlength: '50', disabled: true },
          // { label: '预计归还日期', param: 'expectedReturnTime', type: 'datePicker', format: 'yyyy-MM-dd' },
        ],
        basicList: [
          {
            label: '存放区域',
            field: 'storageDistrict',
            span: 12,
            list: 'regionList',
            type: 'select',
            maxlength: '50',
          },
          {
            label: '存放位置',
            field: 'newStorageLocation',
            span: 12,
            list: 'deptList',
            type: 'input',
            maxlength: '50',
          },
          {
            label: '附件',
            field: 'assetsChangesAnnexDTPList',
            type: 'slot',
            span: 24,
          },
          {
            label: '',
            field: 'list',
            type: 'slot',
            span: 24,
            labelWidth: '0px',
          },
        ],
      }
      // this.$router.push({ path: '/specialProject/assets/assetLibraryDetail', query: { id: this.ids[0], title: '归还' } })
    },
    // 维修
    async handleRepair() {
      var data = await this.getDetails()
      data.forEach((item) => {
        item.deviceStatus = '2'
        item.assetChangeLogType = 4
      })
      this.propData = {}
      this.borrowTitle = '维修'
      this.borrowVisible = true
      this.propData = {
        selectData: data,
        formRules: {
          storageDistrict: [{ required: true, message: '不能为空', trigger: 'blur' }],
          newStorageLocation: [{ required: true, message: '不能为空', trigger: 'blur' }],
          newRepairTime: [{ required: true, message: '不能为空', trigger: 'blur' }],
          repairLocation: [{ required: true, message: '不能为空', trigger: 'blur' }],
          maintenanceManufacturerName: [{ required: true, message: '不能为空', trigger: 'blur' }],
          assetsChangesAnnexDTPList: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
        },
        tableDataList: [
          { label: '设备编号', param: 'assetCode' },
          { label: '设备IP', param: 'ip', type: 'input', maxlength: '50', disabled: true },
          { label: '设备密级', param: 'securityLevel', type: 'select', list: 'securityList', disabled: true },
          { label: '责任部门', param: 'assetDepartmentName', type: 'select', list: 'deptList', disabled: true },
          { label: '责任人', param: 'ownerName', type: 'select', list: 'userList', disabled: true },
          {
            label: '维修费用',
            param: 'cost',
            type: 'input',
            maxlength: 20,
            addRedStar: (h, { column }) => {
              return [h('span', { style: 'color: red' }, '*'), h('span', ' ' + column.label)]
            },
          },
          { label: '备注', param: 'remark', type: 'input', maxlength: '50' },
        ],
        basicList: [
          {
            label: '存放区域',
            field: 'storageDistrict',
            span: 12,
            list: 'regionList',
            type: 'select',
            maxlength: '50',
          },
          {
            label: '存放位置',
            field: 'newStorageLocation',
            span: 12,
            list: 'deptList',
            type: 'input',
            maxlength: '50',
          },
          {
            label: '维修时间',
            field: 'newRepairTime',
            span: 12,
            type: 'dateRange',
            format: 'yyyy-MM-dd',
          },
          {
            label: '维修地点',
            field: 'repairLocation',
            type: 'input',
            span: 12,
            maxlength: '50',
          },
          {
            label: '维修厂商',
            field: 'maintenanceManufacturerName',
            type: 'input',
            span: 12,
            maxlength: '50',
          },
          {
            label: '附件',
            field: 'assetsChangesAnnexDTPList',
            type: 'slot',
            span: 24,
          },
          {
            label: '',
            field: 'list',
            type: 'slot',
            span: 24,
            labelWidth: '0px',
          },
        ],
      }

      // this.$router.push({ path: '/specialProject/assets/assetLibraryDetail', query: { id: this.ids[0], title: '维修' } })
    },
    // 报废
    async handleDiscard() {
      var data = await this.getDetails()
      data.forEach((item) => {
        item.deviceStatus = '3'
        item.assetChangeLogType = 5
      })
      this.propData = {}
      this.borrowTitle = '报废'
      this.borrowVisible = true
      this.propData = {
        scrap: true,
        clear: true,
        selectData: data,
        formRules: {
          storageDistrict: [{ required: true, message: '不能为空', trigger: 'blur' }],
          newStorageLocation: [{ required: true, message: '不能为空', trigger: 'blur' }],
          assetsChangesAnnexDTPList: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
        },
        tableDataList: [
          { label: '设备编号', param: 'assetCode' },
          { label: '设备IP', param: 'ip', type: 'input', maxlength: '50', disabled: true },
          { label: '设备密级', param: 'securityLevel', type: 'select', list: 'securityList', disabled: true },
          { label: '责任部门', param: 'assetDepartmentName', type: 'select', list: 'deptList', disabled: true },
          { label: '责任人', param: 'ownerName', type: 'select', list: 'userList', disabled: true },

          { label: '责任部门id', param: 'assetDepartmentId', type: 'select', list: 'deptList', show: true },
          { label: '责任人id', param: 'ownerId', type: 'select', list: 'userList', show: true },
          { label: '接入交换机', param: 'exchange', type: 'input', maxlength: '50', disabled: true },
          { label: '使用类型', param: 'usageType', type: 'select', list: 'usageTypeList', disabled: true },
          { label: '存放位置', param: 'storageLocation', type: 'input', maxlength: '50', disabled: true },
          { label: '报废原因', param: 'discardReason', type: 'input', maxlength: '50' },
          // { label: '预计归还日期', param: 'expectedReturnTime', type: 'datePicker', format: 'yyyy-MM-dd' },
        ],
        basicList: [
          {
            label: '存放区域',
            field: 'storageDistrict',
            span: 12,
            list: 'regionList',
            type: 'select',
            maxlength: '50',
          },
          {
            label: '存放位置',
            field: 'newStorageLocation',
            span: 12,
            list: 'deptList',
            type: 'input',
            maxlength: '50',
          },
          {
            label: '附件',
            field: 'assetsChangesAnnexDTPList',
            type: 'slot',
            span: 24,
          },
          {
            label: '',
            field: 'list',
            type: 'slot',
            span: 24,
            labelWidth: '0px',
          },
        ],
      }
      // this.$router.push({ path: '/specialProject/assets/assetLibraryDetail', query: { id: this.ids[0], title: '报废' } })
    },
    // 待报废
    async handleToDiscard() {
      var data = await this.getDetails()
      data.forEach((item) => {
        item.deviceStatus = '4'
        item.assetChangeLogType = 6
      })
      this.propData = {}
      this.borrowTitle = '待报废'
      this.borrowVisible = true
      this.propData = {
        selectData: data,
        formRules: {
          storageDistrict: [{ required: true, message: '不能为空', trigger: 'blur' }],
          newStorageLocation: [{ required: true, message: '不能为空', trigger: 'blur' }],
        },
        tableDataList: [
          { label: '设备编号', param: 'assetCode' },
          { label: '设备IP', param: 'ip', type: 'input', maxlength: '50', disabled: true },
          { label: '设备密级', param: 'securityLevel', type: 'select', list: 'securityList', disabled: true },
          { label: '责任部门', param: 'assetDepartmentName', type: 'select', list: 'deptList', disabled: true },
          { label: '责任人', param: 'ownerName', type: 'select', list: 'userList', disabled: true },
          { label: '接入交换机', param: 'exchange', type: 'input', maxlength: '50', disabled: true },
          { label: '使用类型', param: 'usageType', type: 'select', list: 'usageTypeList', disabled: true },
          { label: '存放位置', param: 'storageLocation', type: 'input', maxlength: '50', disabled: true },
          // { label: '预计归还日期', param: 'expectedReturnTime', type: 'datePicker', format: 'yyyy-MM-dd' },
        ],
        basicList: [
          {
            label: '存放区域',
            field: 'storageDistrict',
            span: 12,
            list: 'regionList',
            type: 'select',
            maxlength: '50',
          },
          {
            label: '存放位置',
            field: 'newStorageLocation',
            span: 12,
            list: 'deptList',
            type: 'input',
            maxlength: '50',
          },
          {
            label: '',
            field: 'list',
            type: 'slot',
            span: 24,
            labelWidth: '0px',
          },
        ],
      }
      // this.$router.push({ path: '/specialProject/assets/assetLibraryDetail', query: { id: this.ids[0], title: '待报废' } })
    },

    // 修改
    handleEdit(row) {
      this.$router.push({
        path: '/specialProject/assets/assetLibraryDetail',
        query: {
          id: row.id,
          title: '修改',
          dictValue: row.dictItems.dictValue,
          dictKey: row.dictItems.dictKey,
          dictId: row.dictItems.id,
        },
      })
    },
    // 详情
    handleDetail(row) {
      this.$router.push({
        path: '/specialProject/assets/assetLibraryDetail',
        query: {
          id: row.id,
          title: '详情',
          dictValue: row.dictItems.dictValue,
          dictKey: row.dictItems.dictKey,
          dictId: row.dictItems.id,
        },
      })
    },
    // 导入
    handleImport() {
      this.$refs.import_dia.show()
    },
    handleDown() {
      this.gDownload(window.baseUrl.action + '/assetsInfo/template', {}, `资产库管理模板.xlsx`)
    },
    // 导出
    handleExport() {
      if (this.queryParams.assetTypeId) {
        this.queryParams.assetTypeId = this.queryParams.assetTypeId.toString()
      }
      this.gDownload(
        window.baseUrl.action + '/assetsInfo/export',
        this.queryParams,
        `资产库管理${new Date().getTime()}.xlsx`
      )
      // this.download(window.baseUrl.action + '/assetsInfo/export',
      //   {
      //     ...this.queryParams
      //   },
      //   `出入境${new Date().getTime()}.xlsx`, 'object')
    },
    // 打印
    handlePrint() {},
  },
}
</script>
<style lang="scss" scoped>
::v-deep .reverse {
  .el-select .el-input .el-select__caret.is-reverse {
    transform: rotateZ(0deg) !important;
  }
}
.table-out {
  position: relative;
  .out-son {
    position: absolute;
    bottom: 0;
    left: 0;
  }
}
.middle {
  height: 100%;
  text-align: center;
}
.ca-select {
  width: 220px;
  min-height: 32px;
  .fake {
    float: left;
    z-index: 9;
  }
  .test {
    float: left;
    visibility: hidden;
    width: 0px;
    height: 0px;
    z-index: -1;
  }
}
.clearfix:after {
  /*添加一个内容*/
  content: '';
  /*转换为一个块元素*/
  display: block;
  /*清除两侧的浮动*/
  clear: both;
}
.test {
  visibility: hidden;
}
// 深色背景下
#app.dark-theme {
  .header-top,
  .header-bottom,
  .app-container .app-row {
    background: transparent !important;
    color: #fff !important;
  }
  .bottom-box {
    color: #fff;
    border: 0.0625rem solid #097597;
  }
  .box-one,
  .box-three-right {
    border-right: 0.0625rem solid #097597;
  }
  .bf-status {
    color: #fff;
  }
}

.dialog-row {
  height: 12.5rem;
  padding: 1.25rem;
}
.asset-type {
  border-radius: 0.125rem;
  margin: 0.625rem;
  // padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  // width: 6.25rem;
  height: 2rem;
  line-height: 2rem;
  border: 0.0625rem solid rgba(217, 217, 217, 1);
  border-radius: 0.25rem;
  background: transparent;
  &:hover {
    background: #5170e7;
    color: #fff;
  }
}
.chose {
  background: #5170e7;
  color: #fff;
}
.bf-status {
  color: #2f343e;
}
.app-container {
  background: #eef0f5 !important;
  padding: 0rem !important;
  height: 100%;
  .header-top {
    background: #fff;
    padding: 1.25rem;
    padding-bottom: 0rem;
    // padding-right: % !important;
    border-radius: 0.25rem;
    display: flex;
  }
  .header-bottom {
    background: #fff;
    padding: 1.25rem;
    padding-top: 0rem !important;
    border-radius: 0.25rem;
    display: flex;
    margin-bottom: 1.25rem;
    // padding-bottom: 2.5rem;
    font-size: 0.75rem;
    width: 100%;
    // display: inline-block;
    overflow-x: auto;
    // justify-content: space-between;
    .bottom-box {
      display: flex;
      border: 0.0625rem solid rgba(217, 217, 217, 1);
      border-radius: 0.125rem;
      margin-right: 0.625rem;
      flex-shrink: 0;
      // cursor: pointer;
      .box-one {
        height: 2.1875rem;
        padding: 0.8125rem 0.625rem;
        border-right: 0.0625rem solid rgba(217, 217, 217, 1);
      }
      .box-two {
        height: 2.1875rem;
        padding: 0.8125rem 0.625rem;
        border-right: 0.0625rem solid rgba(217, 217, 217, 1);
      }
      .box-three {
        height: 2.1875rem;
        padding: 0.8125rem 0.625rem;
      }
      .box-three-right {
        border-right: 0.0625rem solid rgba(217, 217, 217, 1);
        height: 2.1875rem;
        padding: 0.8125rem 0.625rem;
      }
    }
  }
  .app-row {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    display: flex;
    background: #fff !important;
    overflow: auto;

    .col-left {
      height: 100%;
      display: flex;
      flex-direction: column;
      width: 15.5rem;
      padding: 20px;
      overflow: auto;
      border-right: 0.0625rem solid rgba(0, 0, 0, 0.08);
      flex-shrink: 0;
    }
    .col-right {
      padding: 1.25rem;
      flex: 1;
      height: 100%;
      display: flex;
      flex-direction: column;
      overflow: auto;
      .bac-red {
        display: inline-block;
        text-align: center;
        // width: 3.125rem;
        padding: 0px 10px;
        height: 1.25rem;
        line-height: 1.25rem;
        background: rgba(255, 53, 53, 0.1);
        border: 0.0625rem solid rgba(255, 53, 53, 1);
        border-radius: 0.75rem;
        color: #ff3535;
        font-size: 0.75rem;
      }
      .bac-pink {
        display: inline-block;
        text-align: center;
        // width: 3.125rem;
        padding: 0px 10px;
        height: 1.25rem;
        line-height: 1.25rem;
        background: rgba(255, 103, 39, 0.1);
        border: 0.0625rem solid rgba(255, 103, 39, 1);
        border-radius: 0.75rem;
        color: #ff6727;
        font-size: 0.75rem;
      }
      .bac-blue {
        display: inline-block;
        text-align: center;
        // width: 3.125rem;
        padding: 0px 10px;
        height: 1.25rem;
        line-height: 1.25rem;
        background: rgba(58, 191, 129, 0.1);
        border: 0.0625rem solid rgba(58, 191, 129, 1);
        border-radius: 0.75rem;
        color: #3abf81;
        font-size: 0.75rem;
      }
      .bac-green {
        display: inline-block;
        text-align: center;
        // width: 3.125rem;
        padding: 0px 10px;
        height: 1.25rem;
        line-height: 1.25rem;
        background: rgba(24, 95, 219, 0.1);
        border: 0.0625rem solid #607ff1;
        border-radius: 0.75rem;
        color: #607ff1;
        font-size: 0.75rem;
      }
    }
  }
}
::v-deep {
  .el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
    background-color: #4b6eef !important;

    color: #fff !important;
  }
  .content[data-v-307320bc] {
    margin-bottom: 0rem !important;
  }
  // 去掉表格里多出来的横线
  .el-table__fixed {
    width: 0;
  }
  // 树形文本超出显示省略号
  // .el-tree-node__label {
  //   white-space: nowrap;
  //   overflow: hidden;
  //   text-overflow: ellipsis;
  // }
  .el-table__cell {
    // white-space: nowrap;
    // overflow: hidden;
    // text-overflow: ellipsis !important;
  }
  .hk-tag {
    margin: 0 0.3125rem;
    margin-top: 0.3125rem;
  }

  .activeName {
    background: rgba(24, 95, 219, 0.1);
  }
}
// ::v-deep .el-dialog__body {
//   padding: 0 !important;
// }
.roku {
  ::v-deep .el-dialog__body {
    padding: 0 !important;
  }
}
::v-deep .el-divider--horizontal {
  margin: 0 !important;
}
::v-deep .card-tree {
  height: calc(100vh - 240px);
  overflow: auto;
  .el-tree-node.is-expanded > .el-tree-node__children {
    display: inline;
  }
}
</style>
